package com.shujia

import java.io.FileWriter

object Demo4FileWrite {
  def main(args: Array[String]): Unit = {
    /**
     * scala中文件写入需要使用java的api
     */

    val fileWriter = new FileWriter("scala/data/words.txt")

    fileWriter.write("java")
    fileWriter.write("\n")
    fileWriter.write("java")
    fileWriter.write("\n")
    fileWriter.write("java")
    fileWriter.write("\n")
    fileWriter.write("java")
    fileWriter.write("\n")
    fileWriter.write("java")

    fileWriter.flush()

    fileWriter.close()
  }

}
